package com.oocl.euc.core.maintenance.repository;

import com.oocl.euc.core.maintenance.model.Status;
import com.oocl.euc.framework.base.persistence.IBaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StatusRepository extends IBaseRepository<Status, Long> {

    @Query("SELECT s FROM Status s WHERE s.statusName=?1 AND s.active=true ORDER BY s.sortSeq")
    Status findStatusByName(String statusName);

    @Query("SELECT s FROM Status s WHERE s.statusType=?1 AND s.active=true ORDER BY s.sortSeq")
    List<Status> getStatusByType(String statusType);

    List<Status> findStatusesByStatusNameIn(List<String> statusName);
}
